]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-theme-node: Add a to_string function for debugging purposes
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 5 Apr 2013 01:43:42 +0000 (21:43 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 3 May 2013 19:56:05 +0000 (15:56 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=697274

src/st/st-theme-node.c
src/st/st-theme-node.h

index a9a1fb58c453a42dcdb9ee917621a8f2b7ad78dc..51355a32a3ffa4bab68104b206fa697c2fe7cbd0 100644 (file)
@@ -3894,3 +3894,30 @@ st_theme_node_paint_equal (StThemeNode *node,
 
   return TRUE;
 }
+
+gchar *
+st_theme_node_to_string (StThemeNode *node)
+{
+  GString *desc;
+  gchar **it;
+
+  if (!node)
+    return g_strdup ("[null]");
+
+  desc = g_string_new (NULL);
+  g_string_append_printf (desc,
+                          "[%p %s#%s",
+                          node,
+                          g_type_name (node->element_type),
+                          node->element_id);
+
+  for (it = node->element_classes; it && *it; it++)
+    g_string_append_printf (desc, ".%s", *it);
+
+  for (it = node->pseudo_classes; it && *it; it++)
+    g_string_append_printf (desc, ":%s", *it);
+
+  g_string_append_c (desc, ']');
+
+  return g_string_free (desc, FALSE);
+}
index fc6caa130215a02f7737afcc3e3f1da6561083ff..dabd5f544d322a0771c26cf80b59d67b7478edb9 100644 (file)
@@ -271,6 +271,8 @@ void st_theme_node_paint (StThemeNode            *node,
 void st_theme_node_invalidate_background_image (StThemeNode *node);
 void st_theme_node_invalidate_border_image (StThemeNode *node);
 
+gchar * st_theme_node_to_string (StThemeNode *node);
+
 void st_theme_node_paint_state_init (StThemeNodePaintState *state);
 void st_theme_node_paint_state_free (StThemeNodePaintState *state);
 void st_theme_node_paint_state_copy (StThemeNodePaintState *state,